/*
 * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @Date: 2025-02-20 23:07:23
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2025-06-25 21:27:01
 * @FilePath: \ruoyi-ui\src\api\system\device.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi";
import { getToken } from '@/utils/auth'
// ====================设备台账====================
export function ledgerList(data) {
  return request({
    url: '/device/ledger/list',
    method: 'get',
    params: data
  })
}
export function ledgerAdd(data) {
  return request({
    url: '/device/ledger',
    method: 'post',
    data: data
  })
}
export function ledgerUpdate(data) {
  return request({
    url: '/device/ledger',
    method: 'put',
    data: data
  })
}

export function ledgerDel(id) {
  return request({
    url: '/device/ledger/' + id,
    method: 'DELETE',
  })
}
export function ledgerDetail(id) {
  return request({
    url: '/device/ledger/' + id,
    method: 'get',
  })
}
// ========================设备报警====================
export function alarmList(data) {
  return request({
    url: '/device/alarm/list',
    method: 'get',
    params: data
  })
}
// ========================巡检计划====================
export function planList(data) {
  return request({
    url: '/inspection/plan/list',
    method: 'get',
    params: data
  })
}
export function planAdd(data) {
  return request({
    url: '/inspection/plan',
    method: 'post',
    data: data
  })
}
export function planUpdate(data) {
  return request({
    url: '/inspection/plan',
    method: 'put',
    data: data
  })
}

export function planDel(id) {
  return request({
    url: '/inspection/plan/' + id,
    method: 'DELETE',
  })
}
export function planDetail(id) {
  return request({
    url: '/inspection/plan/' + id,
    method: 'get',
  })
}
// =======================巡检工单======================
export function recodeList(data) {
  return request({
    url: '/inspection/recode/list',
    method: 'get',
    params: data
  })
}
export function recodeDetail(id) {
  return request({
    url: '/inspection/recode/' + id,
    method: 'get',
  })
}
export function recodeFinish(data) {
  return request({
    url: '/inspection/recode/finish',
    method: 'post',
    data: data
  })
}
// =======================巡检标准======================
export function standardList(data) {
  return request({
    url: '/inspection/standard/list',
    method: 'get',
    params: data
  })
}

export function standardAdd(data) {
  return request({
    url: '/inspection/standard',
    method: 'post',
    data: data
  })
}
export function standardUpdate(data) {
  return request({
    url: '/inspection/standard',
    method: 'put',
    data: data
  })
}

export function standardDel(id) {
  return request({
    url: '/inspection/standard/' + id,
    method: 'DELETE',
  })
}
export function standardDetail(id) {
  return request({
    url: '/inspection/standard/' + id,
    method: 'get',
  })
}
// ===============================维修列表=========================
export function repairList(data) {
  return request({
    url: '/device/repair/list',
    method: 'get',
    params: data
  })
}
export function repairAdd(data) {
  return request({
    url: '/device/repair',
    method: 'post',
    data: data
  })
}
export function repairDel(id) {
  return request({
    url: '/device/repair/' + id,
    method: 'DELETE',
  })
}
export function repairDetail(id) {
  return request({
    url: '/device/repair/' + id,
    method: 'get',
  })
}
export function repairDispatch(data) {
  return request({
    url: '/device/repair/dispatch',
    method: 'put',
    data: data
  })
}

export function repairSolve(id) {
  return request({
    url: '/device/repair/solve/' + id,
    method: 'put',
  })
}
export function productionDashboard(data) {
  return request({
    url: '/api/stats/productionDashboard/',
    method: 'get',
    params: data
  })
}

export function energyDashboard(data) {
  return request({
    url: '/api/stats/energyDashboard/',
    method: 'get',
    params: data
  })
}
export function qualityDashboard(data) {
  return request({
    url: '/api/stats/qualityDashboard/',
    method: 'get',
    params: data
  })
}
export function overviewDashboard(data) {
  return request({
    url: '/api/stats/overviewDashboard/',
    method: 'get',
    params: data
  })
}
export function materialDashboard(data) {
  return request({
    url: '/api/stats/materialDashboard/',
    method: 'get',
    params: data
  })
}

export function realtimeList(data) {
  return request({
    url: '/energy/realtime/list',
    method: 'get',
    params: data
  })
}
export function realtimeHistory(data) {
  return request({
    url: '/energy/realtime/history',
    method: 'get',
    params: data
  })
}

export function realtimeAnalysis(data) {
  return request({
    url: '/energy/realtime/analysis',
    method: 'get',
    params: data
  })
}
export function realtimeExport(data) {
  return request({
    url: '/energy/realtime/export',
    method: 'post',
    params: data
  })
}
// export function exportRole(query) {
//   return request({
//     url: '/system/role/export',
//     method: 'get',
//     params: query
//   })
// }

// =======================保养标准======================
export function maintenanceList(data) {
  return request({
    url: '/maintenance/standard/list',
    method: 'get',
    params: data
  })
}

export function maintenanceAdd(data) {
  return request({
    url: '/maintenance/standard',
    method: 'post',
    data: data
  })
}
export function maintenanceUpdate(data) {
  return request({
    url: '/maintenance/standard',
    method: 'put',
    data: data
  })
}

export function maintenanceDel(id) {
  return request({
    url: '/maintenance/standard/' + id,
    method: 'DELETE',
  })
}
export function maintenanceDetail(id) {
  return request({
    url: '/maintenance/standard/' + id,
    method: 'get',
  })
}
// ========================保养计划====================
export function maintenancePlanList(data) {
  return request({
    url: '/maintenance/plan/list',
    method: 'get',
    params: data
  })
}
export function maintenancePlanAdd(data) {
  return request({
    url: '/maintenance/plan',
    method: 'post',
    data: data
  })
}
export function maintenancePlanUpdate(data) {
  return request({
    url: '/maintenance/plan',
    method: 'put',
    data: data
  })
}

export function maintenancePlanDel(id) {
  return request({
    url: '/maintenance/plan/' + id,
    method: 'DELETE',
  })
}
export function maintenancePlanDetail(id) {
  return request({
    url: '/maintenance/plan/' + id,
    method: 'get',
  })
}
// =======================保养工单======================
export function maintenanceRecodeList(data) {
  return request({
    url: '/maintenance/recode/list',
    method: 'get',
    params: data
  })
}
export function maintenanceRecodeDetail(id) {
  return request({
    url: '/maintenance/recode/' + id,
    method: 'get',
  })
}
export function maintenanceRecodeFinish(data) {
  return request({
    url: '/maintenance/recode/finish',
    method: 'post',
    data: data
  })
}